'use strict';
(function() {

	ngApp.service("userlogService", ['$http', function($http) {
		return {
			queryList: function(pagin, func) {
				$http({
					method: "GET",
					url: "./test/data/userlog.json"
				}).then(function(resp) {
					console.info("userlogService.queryList...");
					if (typeof func == 'function') {
						if (pagin.recordCnt == 0) {
							pagin.recordCnt = resp.data.length;
						}

						var pageIndex = pagin.pageIndex || 1;

						var startIndex = pagin.pageSize * (pageIndex - 1);
						var endIndex = pagin.pageSize * pageIndex;

						var arr = resp.data.slice(startIndex, endIndex);

						var rst = {
							pagin: pagin,
							data: arr
						};

						func(rst);
					}
				});
			}
		};

	}]);


})();